package com.siberhus.tdfl.processor;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.siberhus.tdfl.Employee;
import com.siberhus.tdfl.FieldDataException;
import com.siberhus.tdfl.processor.AbstractDataFileProcessor;

public class EmployeeBeanWrapDfp extends AbstractDataFileProcessor<Employee>{

	private Log logger = LogFactory.getLog(EmployeeBeanWrapDfp.class);
	
	@Override
	public void validateItem(Employee item, FieldDataException fde)
			throws Exception {
		if(item.getEmail()==null){
			fde.addError("email", "missing required field");
		}
	}
	
	@Override
	public void processItem(Employee item) throws Exception {
		logger.info("Saving 'employee' data-> "+item);
	}

	@Override
	public void onItemError(Employee item, Exception exception) {
		logger.warn("Item error -> "+item);
	}
	
	
}
